#define _CRT_SECURE_NO_WARNINGS 1
#include <iostream>
#include <string.h>

using namespace std;

const int MAXSIZE = 100;
int g_iArr[MAXSIZE];

bool isOk()
{
	int iTemp;
	int iNext;
	int iCur = 100000;
	for (int j = g_iArr[0]; j >= 1; j--)
	{
		iNext = g_iArr[j];
		if (iCur <= iNext)
		{
			return false;
		}
		iCur = iNext;
	}
	return true;
}

void dfs(int n, int r)
{
	for (int i = n; i >= r; i--)
	{

		g_iArr[r] = i;

		if (r == 1)
		{
			if (isOk())
			{
				for (int j = g_iArr[0]; j >= 1; j--)
				{
					cout << g_iArr[j];
				}
				cout << endl;
			}
		}

		else
		{

			dfs(n - 1, r - 1);
		}
	}
}

void process()
{
	int n, r;
	while (EOF != scanf("%d %d", &n, &r))
	{

		g_iArr[0] = r;
		dfs(n, r);
	}
}

int main(int argc, char* argv[])
{
	process();
	getchar();
	return 0;
}